// 医护管理-血压记录

import r from '@/utils/request';
import type { ResponseType, ListParams, ListResponseType } from '../types';

enum API {
    bloodPressureDeleteAll = '/bloodPressure/deleteAll', // 血压记录批量删除
    bloodPressureList = '/bloodPressure/list', // 血压记录列表
    bloodPressureGet = '/bloodPressure/get', // 获取单条血压记录信息
    bloodPressureDelete = '/bloodPressure/delete', // 删除血压记录信息
    bloodPressureAdd = '/bloodPressure/add', // 血压记录添加
    bloodPressureUpdate = '/bloodPressure/update', // 血压记录修改
}

export interface getBloodPressure {
    elderlyId: number;
    elderlyName: string;
}

export interface bloodPressureItem {
    id: number;
}

// 血压记录批量删除接口
export function bloodPressureDeleteAllAPI(id: number[]): Promise<ResponseType<string>> {
    return r.post(API.bloodPressureDeleteAll, id)
}

// 血压记录列表参数
interface bloodPressureListParams extends ListParams {
    name: string;
    beginDate: string;
    endDate: string;
    begId: string;
    addTime: string;
    staffId: number;
}

// 血压记录列表返回值
type bloodPressureListRes = ListResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    addTime: string;
    addAccountId: number;
    bloodPressure: string;
    pulse: string;
    begId: number;
    begName: string;
    idCard: string;
    addAccountName: string;
    addAccountPhoto: string;
    elderlyName: string;
    elderlyPhoto: string;
    elderlyGender: string;
    elderlyIdCard: string;
    houseName: string;
    buildingName: string;
    staffId: number;
    staffName: string;
    staffPhoto: string;
}>

// 血压记录列表接口
export function bloodPressureListAPI(params: bloodPressureListParams): Promise<bloodPressureListRes> {
    return r.get(API.bloodPressureList, params)
}

// 获取单条血压记录信息返回值
type bloodPressureGetRes = ResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    addTime: string;
    addAccountId: number;
    bloodPressure: string;
    pulse: string;
    begId: number;
    begName: string;
    idCard: string;
    addAccountName: string;
    addAccountPhoto: string;
    elderlyName: string;
    elderlyPhoto: string;
    elderlyGender: string;
    elderlyIdCard: string;
    houseName: string;
    buildingName: string;
    staffId: number;
    staffName: string;
    staffPhoto: string;
}>

// 获取单条血压记录信息接口
export function bloodPressureGetAPI(id: number): Promise<bloodPressureGetRes> {
    return r.get(API.bloodPressureGet + '/' + id)
}

// 删除血压记录信息接口
export function bloodPressureDeleteAPI(id: number): Promise<ResponseType<string>> {
    return r.delete(API.bloodPressureDelete + '/' + id)
}


// 血压记录添加参数
export interface bloodPressureAddParams {
    elderlyId: number;
    bloodPressure: string;
    // staffId: number;
    pulse: string;
}

// 血压记录添加返回值
type bloodPressureAddRes = ResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    addTime: string;
    addAccountId: number;
    bloodPressure: string;
    pulse: string;
    begId: number;
    begName: string;
    idCard: string;
    addAccountName: string;
    addAccountPhoto: string;
    elderlyName: string;
    elderlyPhoto: string;
    elderlyGender: string;
    elderlyIdCard: string;
    houseName: string;
    buildingName: string;
    staffId: number;
    staffName: string;
    staffPhoto: string;
}>


// 血压记录添加接口
export function bloodPressureAddAPI(params: bloodPressureAddParams): Promise<bloodPressureAddRes> {
    return r.post(API.bloodPressureAdd, params)
}


// 血压记录修改参数
export interface bloodPressureUpdateParams {
    id: number;
    elderlyId: number;
    bloodPressure: string;
    pulse: string;
}

// 血压记录修改返回值
type bloodPressureUpdateRes = ResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    addTime: string;
    addAccountId: number;
    bloodPressure: string;
    pulse: string;
    begId: number;
    begName: string;
    idCard: string;
    addAccountName: string;
    addAccountPhoto: string;
    elderlyName: string;
    elderlyPhoto: string;
    elderlyGender: string;
    elderlyIdCard: string;
    houseName: string;
    buildingName: string;
    staffId: number;
    staffName: string;
    staffPhoto: string;
}>

// 血压记录修改接口
export function bloodPressureUpdateAPI(params: bloodPressureUpdateParams): Promise<bloodPressureUpdateRes> {
    return r.put(API.bloodPressureUpdate, params)
}